package com.ymatou.iapi.sellercs.testcase;

import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

import org.apache.http.client.ClientProtocolException;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.sellercs.parameter.CsSessionDetail;
import com.ymatou.iapi.sellercs.parameter.SendMessageBean;
import com.ymatou.iapi.sellercs.parameter.SendMessageResp;
import com.ymatou.iapi.sellercs.service.SendMessageCall;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.business.service.SellerCSIMCallService;
import com.ymttest.database.model.YmtCssession;
import com.ymttest.database.model.YmtMessage;
import com.ymttest.database.model.YmtQueuesession;
import com.ymttest.database.model.YmtRiskymessage;
import com.ymttest.database.model.YmtRiskyuser;
import com.ymttest.database.redis.ImRedisWapper;
import com.ymttest.database.sqlwapper.ImDefaultWapper;
import com.ymttest.database.sqlwapper.JUserWapper;
import com.ymttest.database.sqlwapper.YmtSellerCSIMWapper;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.TestDataManager;

import redis.clients.jedis.Tuple;
/**
*SendMessage
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_SendMessage{
	private static SendMessageBean sendmessageBean;
	private static SendMessageCall sendmessageCall;
	private static int sellerId = Integer.parseInt(EnvSetup.getData("autotest_seller1"));
	private static String sellername = EnvSetup.getData("autotest_sellerName1");
	private static YmtSellerCSIMWapper YmtSellerCSIMWapper;
	private static int zsellerId = Integer.parseInt(EnvSetup.getData("autotest_seller_z"));
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("SendMessage");
	}

	@Before
	public void caseUp() throws ClientProtocolException, IOException {
		sendmessageBean=new SendMessageBean();
		sendmessageCall=new SendMessageCall();
		YmtSellerCSIMWapper=new YmtSellerCSIMWapper();
		SellerCSIMCallService.OffLine(sellerId, null);
		SellerCSIMCallService.OffLine(zsellerId, null);
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(sendmessageCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	/**
	 * 初始化用户发送
	 * @param userid
	 * @return
	 */
	private SendMessageBean initSendmessageBean(Integer userId){
		sendmessageBean=new SendMessageBean();
		sendmessageBean.setAutoSetRead(true);
		sendmessageBean.setContent("Content");
		sendmessageBean.setCSId(sellerId);
		sendmessageBean.setCSName(sellername);
		sendmessageBean.setFromUserId(userId);
		sendmessageBean.setIsAutoReply(true);
		sendmessageBean.setMessage("test");
		sendmessageBean.setNeedAutoReply(true);
		sendmessageBean.setToUserId(sellerId);
		return sendmessageBean;
	}
	/**
	 * @param SendMessageBean
	 * @param type <br>0 ymt_queuesession <br>1 ymt_cssession 不在线的时候0 在线1
	 *  * @param unReadCount 期望的未读消息数量
	 * @throws InterruptedException 
	 */
	private void verifyDB(SendMessageBean SendMessageBean,Integer type,Integer unReadCount) throws InterruptedException{
		if(type==0){
			YmtQueuesession info = YmtSellerCSIMWapper.selectYmtQueuesession(SendMessageBean.getToUserId(), SendMessageBean.getFromUserId()).get(0);
			Logger.debug("YmtQueuesession:"+FormatUtil.beanToGSONString(info));
			Logger.verifyEquals(0,info.getAutoReply(),"验证autoreply-固定0");
			Logger.verifyNotNull(info.getBeginTime(),"验证BeginTime");
			Logger.verifyEquals(0,info.getFromPlatform(),"来源平台-固定0");
			Logger.verifyEquals(SendMessageBean.getMessage(), info.getLastMessage(),"验证最后消息");
			Logger.verifyEquals(true,new Date().getTime()-info.getLastMessageTime().getTime()<60000,"LastMessageTime-误差内");
			Logger.verifyEquals(SendMessageBean.getCSId(),info.getMasterCSId(),"验证MasterCSId");
			Logger.verifyEquals(SendMessageBean.getCSName(),info.getMasterCSName(),"验证CSName");
			Logger.verifyEquals(0,info.getOpenType(),"OpenType-固定0");
			Logger.verifyNotNull(info.getPriority(),"验证Priority");
			Logger.verifyNotNull(info.getSessionNumber(),"验证SessionNumber");
			Logger.verifyEquals(unReadCount,info.getUnReadCount(),"unReadCount");
		}
		if(type==1){
			 YmtCssession info = YmtSellerCSIMWapper.selectYmtCssession(SendMessageBean.getToUserId(), SendMessageBean.getFromUserId()).get(0);
			Logger.debug("YmtQueuesession:"+FormatUtil.beanToGSONString(info));
			Logger.verifyNotNull(info.getBeginTime(),"验证BeginTime");
			Logger.verifyEquals(13,info.getFromPlatform(),"来源平台-固定13");
			Logger.verifyEquals(true,new Date().getTime()-info.getLastMessageTime().getTime()<10000,"LastMessageTime-误差内");
			Logger.verifyEquals(SendMessageBean.getCSId(),info.getMasterCSId(),"验证MasterCSId");
			Logger.verifyNotNull(info.getSessionNumber(),"验证SessionNumber");
			Logger.verifyEquals(unReadCount,info.getUnReadCount(),"unReadCount");
		//   0 User,  1  ReAssign, 2 CS
			Logger.verifyEquals(2,info.getOpenType(),"OpenType-2分配打开会话");
			Logger.verifyEquals(null,info.getCloseType(),"CloseType-没有关闭时未设置");
			Logger.verifyEquals(0,info.getStatus(),"Status-0开启");
			Logger.verifyEquals(0,info.getMark(),"Mark-0");
		}
	}
	private void verifyRedis(SendMessageBean SendMessageBean,Integer type,Integer unReadCount) throws InterruptedException{
		if(type==0){
			ImRedisWapper ImRedisWapper=new ImRedisWapper();
			Set<Tuple> set = ImRedisWapper.getQSession(SendMessageBean.getToUserId());
			set.forEach(t->{Logger.debug("tuple:"+t.getScore()+":"+t.getElement());});
			List<String> list = set.stream().map(t->{return t.getElement();}).collect(Collectors.toList());
			Logger.verifyEquals(true,list.contains(sendmessageBean.getFromUserId().toString()),"验证QSession中包含有FromUserId");
		}if(type==1){
			ImRedisWapper ImRedisWapper=new ImRedisWapper();
			Set<Tuple> set = ImRedisWapper.getCSession(SendMessageBean.getToUserId());
			set.forEach(t->{Logger.debug("tuple:"+t.getScore()+":"+t.getElement());});
			List<String> list = set.stream().map(t->{return t.getElement();}).collect(Collectors.toList());
			Logger.verifyEquals(true,list.contains(sendmessageBean.getFromUserId().toString()),"验证CSession中包含有FromUserId");
			CsSessionDetail csSessionDetail = ImRedisWapper.getCSessionDetails(sellerId, SendMessageBean.getFromUserId(),sellerId);
			Logger.debug("CSessionDetails:"+FormatUtil.beanToGSONString(csSessionDetail));
			//TODO 这里没有主子账号考虑?
			Logger.verifyEquals(SendMessageBean.getCSId(),csSessionDetail.getCsId(),"验证csid");
			Logger.verifyEquals(SendMessageBean.getCSName(),csSessionDetail.getCsName(),"验证csname");
			Logger.verifyNotNull(csSessionDetail.getSessionId(),"验证SessionId不为空");
			Logger.verifyNotNull(csSessionDetail.getSessionNumber(),"验证SessionNumber不为空");
		}
	}
	private void verifyReturn(SendMessageBean sendmessageBean2, SendMessageResp result,Boolean isCancel) {
		JUserWapper JUserWapper=new JUserWapper();
		String fromurl=JUserWapper.selectUserinfoexByUid(sendmessageBean2.getFromUserId()).get(0).getLogoUrl();
		Logger.verifyEquals(fromurl==null?JUserCallService.defaultImg:fromurl,result.getFromUserLogo(),"验证FromUserLogo");
		String tourl=JUserWapper.selectUserinfoexByUid(sendmessageBean2.getToUserId()).get(0).getLogoUrl();
		Logger.verifyEquals(tourl==null?JUserCallService.defaultSellerImg:tourl,result.getToUserLogo(),"验证ToUserLogo");
		
		String fromname=JUserWapper.selectUserinfoByUid(sendmessageBean2.getFromUserId()).get(0).getLoginId();
		Logger.verifyEquals(fromname,result.getFromUserName(),"验证FromUserName");
		
		String toname=JUserWapper.selectUserinfoByUid(sendmessageBean2.getToUserId()).get(0).getLoginId();
		Logger.verifyEquals(toname,result.getToUserName(),"验证toname");
		
		Logger.verifyEquals(0,result.getFromUserUnReadMessageCount(),"FromUserUnReadMessageCount");
		Logger.verifyEquals(0,result.getToUserUnReadMessageCount(),"ToUserUnReadMessageCount");
		Logger.verifyNotNull(result.getMessageId(),"验证msgId");
		Logger.verifyEquals(isCancel, sendmessageCall.getResult().getIsCancel(), "验证此消息会被屏蔽");
	}
	
	private YmtMessage verifyMessage(SendMessageBean sendmessageBean2, String messageId) throws InterruptedException {
		YmtMessage msg = new ImDefaultWapper().selectImInfo(sendmessageCall.getResult().getMessageId()).get(0);
		Logger.debug("msg:"+FormatUtil.beanToGSONString(msg));
		Logger.verifyEquals(sendmessageBean2.getFromUserId(),msg.getMsgFromId(),"验证MsgFromId");
		Logger.verifyEquals(sendmessageBean2.getToUserId(),msg.getMsgToId(),"验证MsgToId");
		Logger.verifyEquals(sendmessageBean2.getMessage(),msg.getMessage(),"验证Message");
		return msg;
		
	}
	
//XXX DEMO
//	POST http://sellercsim.iapi.ymatou.com/Api/Message/SendMessage
//		content-type: application/json
//
//		{"AppId":"nodeim.app.ymatou.com","FromUserId":24706437,"Message":"111http://wwww.Ymatou.com","ToUserId":3383,"NeedAutoReply":false}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SendMessage_001() {
		Logger.start(true,"发送消息成功,客服不在线进入ymt_queuesession等待分配客服");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			verifyDB(sendmessageBean,0,1);
			verifyRedis(sendmessageBean, 0, 1);
			//分配QSession的时候msg不发送到im.iapi
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	

	

	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_002() {
		Logger.start(true,"不输入FromUserId失败");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			sendmessageBean=initSendmessageBean(urrc.getUserid());
			sendmessageBean.setFromUserId(null);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("400", sendmessageCall.getString("Status"), "验证Status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_003() {
		Logger.start(true,"不输入ToUserId失败");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			sendmessageBean=initSendmessageBean(urrc.getUserid());
			sendmessageBean.setToUserId(null);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("400", sendmessageCall.getString("Status"), "验证Status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_004() {
		Logger.start(true,"不输入Message失败");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			sendmessageBean=initSendmessageBean(urrc.getUserid());
			sendmessageBean.setMessage(null);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("400", sendmessageCall.getString("Status"), "验证Status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_005() {
		Logger.start(true,"发送消息成功,客服在线进入ymt_cssession客服会话(job调用分配)");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			//APP上线
			SellerCSIMCallService.AppLogin(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			//触发分配
			SellerCSIMCallService.Assign();
			Thread.sleep(3000);
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			//分配QSession的时候msg不发送到im.iapi
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());
			verifyDB(sendmessageBean,1,1);
			verifyRedis(sendmessageBean, 1, 1);
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_006() {
		Logger.start(true,"发送用户不存在失败");
		try {
			sendmessageBean=initSendmessageBean(-1);
			sendmessageBean.setMessage(null);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("400", sendmessageCall.getString("Status"), "验证Status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_007() {
		Logger.start(true,"发送用户被锁定失败");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			Integer userId=urrc.getUserid();
			JUserCallService.lockUsers(userId);
			sendmessageBean=initSendmessageBean(userId);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("500", sendmessageCall.getString("Status"), "验证Status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_008() {
		Logger.start(true,"发送用户注销,失败");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			Integer userId=urrc.getUserid();
			JUserCallService.CloseAccount(userId);
			sendmessageBean=initSendmessageBean(userId);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("500", sendmessageCall.getString("Status"), "验证Status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_009() {
		Logger.start(true,"接收用户不存在失败");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			Integer userId=urrc.getUserid();
			sendmessageBean=initSendmessageBean(userId);
			sendmessageBean.setToUserId(-1);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("400", sendmessageCall.getString("Status"), "验证Status");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_010() {
		Logger.start(true,"买手之间对发消息失败");
		try {
			sendmessageBean=initSendmessageBean(3383);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("500", sendmessageCall.getString("Status"), "验证Status");	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_011() {
		Logger.start(true,"买家之间对发消息失败");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			Integer userId=urrc.getUserid();
			Logger.comment("注册新用户2");
			UserRegisterInfoRequestDtoBean regbean2 = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc2 = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			Integer userId2=urrc2.getUserid();
			sendmessageBean=initSendmessageBean(userId);
			sendmessageBean.setToUserId(userId2);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("400", sendmessageCall.getString("Status"), "验证Status");	
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_012() {
		Logger.start(true,"买手发送给买家(自动路由)");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			//APP上线
			SellerCSIMCallService.AppLogin(sellerId);
			
			sendmessageBean=initSendmessageBean(sellerId);
			sendmessageBean.setToUserId(userId);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			Thread.sleep(1000);
			Logger.comment("这个异常状态不能用通用验证");
			SendMessageResp result = sendmessageCall.getResult();
			JUserWapper JUserWapper=new JUserWapper();
			String fromurl=JUserWapper.selectUserinfoexByUid(sendmessageBean.getFromUserId()).get(0).getLogoUrl();
			Logger.verifyEquals(fromurl==null?JUserCallService.defaultSellerImg:fromurl,result.getFromUserLogo(),"验证FromUserLogo");
			String tourl=JUserWapper.selectUserinfoexByUid(sendmessageBean.getToUserId()).get(0).getLogoUrl();
			Logger.verifyEquals(tourl==null?JUserCallService.defaultImg:tourl,result.getToUserLogo(),"验证ToUserLogo");
			
			String fromname=JUserWapper.selectUserinfoByUid(sendmessageBean.getFromUserId()).get(0).getLoginId();
			Logger.verifyEquals(fromname,result.getFromUserName(),"验证FromUserName");
			
			String toname=JUserWapper.selectUserinfoByUid(sendmessageBean.getToUserId()).get(0).getLoginId();
			Logger.verifyEquals(toname,result.getToUserName(),"验证toname");
			
			Logger.verifyEquals(0,result.getFromUserUnReadMessageCount(),"FromUserUnReadMessageCount");
			Logger.verifyEquals(0,result.getToUserUnReadMessageCount(),"ToUserUnReadMessageCount");
			Logger.verifyNotNull(result.getMessageId(),"验证msgId");
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			//分配QSession的时候msg不发送到im.iapi
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());
			//因为反了所以得反着查询
			 YmtCssession info = YmtSellerCSIMWapper.selectYmtCssession(sendmessageBean.getFromUserId(), sendmessageBean.getToUserId()).get(0);
			 Logger.debug("YmtQueuesession:"+FormatUtil.beanToGSONString(info));
				Logger.verifyNotNull(info.getBeginTime(),"验证BeginTime");
				Logger.verifyEquals(13,info.getFromPlatform(),"来源平台-固定13");
				Logger.verifyEquals(true,new Date().getTime()-info.getLastMessageTime().getTime()<10000,"LastMessageTime-误差内");
				Logger.verifyEquals(sendmessageBean.getCSId(),info.getMasterCSId(),"验证MasterCSId");
				Logger.verifyNotNull(info.getSessionNumber(),"验证SessionNumber");
				Logger.verifyEquals(0,info.getUnReadCount(),"unReadCount");
			//   0 User,  1  ReAssign, 2 CS
				Logger.verifyEquals(2,info.getOpenType(),"OpenType-2分配打开会话");
				Logger.verifyEquals(null,info.getCloseType(),"CloseType-没有关闭时未设置");
				Logger.verifyEquals(0,info.getStatus(),"Status-0开启");
				Logger.verifyEquals(0,info.getMark(),"Mark-0");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_013() {
		Logger.start(true,"风险买家ymt_riskyuser.Disable=true发送消息买手不可见");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			
			YmtSellerCSIMWapper.insertYmtRiskyuser(userId,true);
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			//APP上线
			SellerCSIMCallService.AppLogin(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			//触发分配
//			SellerCSIMCallService.Assign();
			Thread.sleep(1000);
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			
			YmtMessage msg = verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());
			//新注册的账号比seller账号大 所以seller必然小号 , 风险买家对seller不可见SmallSee为1
			Logger.verifyEquals(1,msg.getSmallSee(),"小号消息不可见");
			
			//分配QSession的时候msg不发送到im.iapi
			Logger.verifyEquals(0, YmtSellerCSIMWapper.selectYmtQueuesession(sendmessageBean.getToUserId(), sendmessageBean.getFromUserId()).size(), "风控用户阻止对话");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_014() {
		Logger.start(true,"发送图片记录风险消息[img][/img]");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageBean.setMessage("[img]http://pic1.ymatou.com/G01/M00/3A/B0/rBBlD1n0JquAMmYrAAHCOb9q0j4447_3_4_c.jpg#184x246"+TestDataManager.getRandomNum(5)+"[/img]");
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			verifyDB(sendmessageBean,0,1);
			verifyRedis(sendmessageBean, 0, 1);
			//分配QSession的时候msg不发送到im.iapi
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());		
			
			YmtRiskymessage riskmsg = YmtSellerCSIMWapper.selectYmtRiskymessage(userId, sellerId).get(0);
			Logger.verifyNotNull(riskmsg, "验证有riskmsg");
			Logger.verifyEquals(sendmessageBean.getMessage(), riskmsg.getMessage(), "验证图片风控消息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_015() {
		Logger.start(true,"发送超长消息记录风险消息");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageBean.setMessage("pic1.ymatou.com/G01/M00/3A/B0/rBBlD1n0JquAMmYrAAHCOb9q0j4447_3_4_c.jpg#184x246"+TestDataManager.getRandomNum(5));
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			verifyDB(sendmessageBean,0,1);
			verifyRedis(sendmessageBean, 0, 1);
			//分配QSession的时候msg不发送到im.iapi
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());		
			
			YmtRiskymessage riskmsg = YmtSellerCSIMWapper.selectYmtRiskymessage(userId, sellerId).get(0);
			Logger.verifyNotNull(riskmsg, "验证有riskmsg");
			Logger.verifyEquals(sendmessageBean.getMessage(), riskmsg.getMessage(), "验证图片风控消息");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_016() {
		Logger.start(true,"消息中含有非域名链接地址屏蔽");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageBean.setMessage("http://www.baidu.com/G01/M00/3A/B0/rBBlD1n0JquAMmYrAAHCOb9q0j4447_3_4_c.jpg#184x246"+TestDataManager.getRandomNum(5));
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			YmtQueuesession info = YmtSellerCSIMWapper.selectYmtQueuesession(sendmessageBean.getToUserId(), sendmessageBean.getFromUserId()).get(0);
			Logger.verifyNotEquals(sendmessageBean.getMessage(),info.getLastMessage(), "验证消息修改");
			YmtMessage msg = new ImDefaultWapper().selectImInfo(sendmessageCall.getResult().getMessageId()).get(0);
			Logger.debug("msg:"+FormatUtil.beanToGSONString(msg));
			Logger.verifyNotEquals(sendmessageBean.getMessage(),msg.getMessage(), "验证消息修改");
			YmtRiskymessage riskmsg = YmtSellerCSIMWapper.selectYmtRiskymessage(userId, sellerId).get(0);
			Logger.verifyNotNull(riskmsg, "验证有riskmsg");
			Logger.verifyEquals(sendmessageBean.getMessage(), riskmsg.getMessage(), "验证非域名链接地址屏蔽");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_017() {
		Logger.start(true,"消息中含有ymatou,xlobo域名链接地址不屏蔽");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageBean.setMessage("pic1.xlobo.com/G01/M00/3A/B0/rBBlD1n0JquAMmYrAAHCOb9q0j4447_3_4_c.jpg#184x246"+TestDataManager.getRandomNum(5));
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			verifyDB(sendmessageBean,0,1);
			verifyRedis(sendmessageBean, 0, 1);
			//分配QSession的时候msg不发送到im.iapi
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());		
			
			YmtRiskymessage riskmsg = YmtSellerCSIMWapper.selectYmtRiskymessage(userId, sellerId).get(0);
			Logger.verifyNotNull(riskmsg, "验证有riskmsg");
			Logger.verifyEquals(sendmessageBean.getMessage(), riskmsg.getMessage(), "验证图片风控消息");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_018() {
		Logger.start(true,"已在会话中发消息,更新最后活跃时间,未读消息加一");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			//APP上线
			SellerCSIMCallService.AppLogin(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			//触发分配
			SellerCSIMCallService.Assign();
			Thread.sleep(2000);
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			//分配QSession的时候msg不发送到im.iapi
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());
			verifyDB(sendmessageBean,1,1);
			verifyRedis(sendmessageBean, 1, 1);	
			sendmessageBean.setMessage("msg2:"+new Date().getTime());
			sendmessageCall.callService();	
			Thread.sleep(2000);
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());
			verifyDB(sendmessageBean,1,2);
			verifyRedis(sendmessageBean, 1, 2);		
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_SendMessage_019() {
		Logger.start(true,"已在分配队列中消息,更新最后一条消息,最后活跃时间,未读消息加一");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			Thread.sleep(2000);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());	
			verifyDB(sendmessageBean,0,1);
			verifyRedis(sendmessageBean, 0, 1);
			
			
			Thread.sleep(2000);
			sendmessageBean.setMessage("msg2:"+new Date().getTime());
			sendmessageCall.callService();	
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			Thread.sleep(2000);
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());	
			verifyDB(sendmessageBean,0,2);
			verifyRedis(sendmessageBean, 0, 2);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore
	//测试下来是前端屏蔽
	public void Tc_SendMessage_020() {
		Logger.start(true,"消息中含有js屏蔽");
		try {
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageBean.setMessage("<script>alert('aaa');</script>");
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			verifyDB(sendmessageBean,0,1);
			verifyRedis(sendmessageBean, 0, 1);
			//分配QSession的时候msg不发送到im.iapi
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());		
			
			YmtRiskymessage riskmsg = YmtSellerCSIMWapper.selectYmtRiskymessage(userId, sellerId).get(0);
			Logger.verifyNotNull(riskmsg, "验证有riskmsg");
			Logger.verifyEquals(sendmessageBean.getMessage(), riskmsg.getMessage(), "验证非域名链接地址屏蔽");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	@Ignore
	//这个场景不会拦截 只有seller to user会拦截
	public void Tc_SendMessage_021() {
		Logger.start(true,"发送图片记录风险消息二维码带有非码头链接");
		try {
			String fpath="./temp/noymt.jpg";
			TestDataManager.CreateMatrixFile("http://www.baidu.com/1.jpg", fpath);
			String turl=TestDataManager.UploadFile(fpath);
			Logger.comment("注册新用户");
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);

			JsonObject registerResult = urrc.getJsonObject().get("Result").getAsJsonObject();
			String token = registerResult.get("Token").getAsString();
			Integer userId = urrc.getUserid();
			Logger.comment("删除旧数据");
			YmtSellerCSIMWapper.deleteYmtOnlinecsByCsid(sellerId);
			
			sendmessageBean=initSendmessageBean(userId);
			sendmessageBean.setMessage("加：[img]"+turl+"[/img]");
			sendmessageCall.setData(sendmessageBean);
			sendmessageCall.callService();	
			Logger.verifyIsContains("200", sendmessageCall.getString("Status"), "验证Status");
			Logger.debug("r:"+FormatUtil.beanToGSONString(sendmessageCall.getResult()));
			//用户发的图片不拦截
			verifyReturn(sendmessageBean,sendmessageCall.getResult(),false);
			//"Result":{"MessageId":"24711668_24635724_205831","PostTime":"2018-10-10T16:48:10","LongPostTime":1.5391612905E12,"FromUserUnReadMessageCount":0,"ToUserUnReadMessageCount":0,"FromUserName":"autotestxFXO41U","FromUserLogo":"http://img.ymatou.com/portal/images/default.png","ToUserName":"autotest1","ToUserLogo":"http://img.ymatou.com/portal/images/default.png"}
			verifyDB(sendmessageBean,0,1);
			verifyRedis(sendmessageBean, 0, 1);
			//分配QSession的时候msg不发送到im.iapi
			verifyMessage(sendmessageBean,sendmessageCall.getResult().getMessageId());		
			
			YmtRiskymessage riskmsg = YmtSellerCSIMWapper.selectYmtRiskymessage(userId, sellerId).get(0);
			Logger.verifyNotNull(riskmsg, "验证有riskmsg");
			Logger.verifyEquals(sendmessageBean.getMessage(), riskmsg.getMessage(), "验证图片风控消息");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}